package com.zhouyx.userservice.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zhouyx.userservice.annotation.PermissionAnnotation;
import org.springframework.web.bind.annotation.*;

// https://cloud.tencent.com/developer/article/2110213
@RestController
@RequestMapping(value = "/aop")
public class AopController {

    @GetMapping(value = "/getTest")
    public JSONObject aopTest() {

        return JSON.parseObject("{\"message\":\"SUCCESS\",\"code\":200}");
    }

    @PostMapping(value = "/postTest")
    public JSONObject aopTest2(@RequestParam("id") String id) {

        return JSON.parseObject("{\"message\":\"SUCCESS\",\"code\":200}");
    }

    @RequestMapping(value = "/permission/check", method = RequestMethod.POST)
    // 添加这个注解
    @PermissionAnnotation()
    public JSONObject getGroupList(@RequestBody JSONObject request) {

        return JSON.parseObject("{\"message\":\"SUCCESS\",\"code\":200}");
    }
}
